package com.NeuglsWorkStudio.UI.FormElement.Component
{
	import com.NeuglsWorkStudio.UI.FormElement.Config.TCanDragTipConfig;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TConfig;
	
	import flash.events.MouseEvent;
	import flash.ui.Mouse;
	import flash.ui.MouseCursor;
	
	public class TCanDragTip extends TComponent
	{
		private var _FWidth:Number=0;
		private var _FHeight:Number=0;
		
		public function TCanDragTip(AConfig:TConfig)
		{
			super(AConfig);
		}
		
		
		public function get Height():Number
		{
			return _FHeight;
		}

		public function set Height(value:Number):void
		{
			_FHeight = value;
			Paint();
		}

		public function get Width():Number
		{
			return _FWidth;
		}

		public function set Width(value:Number):void
		{
			_FWidth = value;
			Paint();
		}

		public function DragTipConfig():TCanDragTipConfig{
			return _FConfig as TCanDragTipConfig;
		}
		override protected function Init():void{
			super.Init();
			_FWidth=DragTipConfig().Width;
			_FHeight=DragTipConfig().Height;
			
			Paint();			
		}
		
		protected function Paint():void{
			var DotCount:int=4;
			
			var R:Number=DragTipConfig().dotRadius;
			var lastY:Number=R;
			var SX:Number=_FWidth-2*R;
			var YMargin:Number=(_FHeight-DotCount*2*R)/(DotCount-1);
			var i:int;
			with(this.graphics){
				this.graphics.clear();
				beginFill(DragTipConfig().Color,1);
				for(i=0;i<DotCount;i++){
					drawCircle(0,lastY,R);
					drawCircle(SX,lastY,R);
					lastY+=YMargin;
				}
				
				endFill();
			}
		}
		
	}
}